package control;

import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;

import javax.swing.AbstractAction;

import component.Icons;

import view.LibraryMainJFrame;
import view.LoanOverviewJPanel;

@SuppressWarnings("serial")
public class OpenLoanOverviewAction extends AbstractAction {
	private LibraryMainJFrame frame;
	private static LoanOverviewJPanel panel;
	
	public OpenLoanOverviewAction(LibraryMainJFrame frame) {
		super("Ausleihen", Icons.LOANS);
		putValue(MNEMONIC_KEY, KeyEvent.VK_A);
		this.frame = frame;
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		if(panel == null){
			panel = new LoanOverviewJPanel(frame);
		}
		frame.openContentPanel(panel);
	}
}
